
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module main</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>main</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/v/filer4b/v38q001/eshrews/CS373/ericdaniel373primes/main.py">/v/filer4b/v38q001/eshrews/CS373/ericdaniel373primes/main.py</a></font></td></tr></table>
    <p><tt>#&nbsp;-------------------------------<br>
#&nbsp;projects/python#main.py<br>
#&nbsp;Copyright&nbsp;(C)&nbsp;2009<br>
#&nbsp;Eric&nbsp;Shrewsberry&nbsp;and&nbsp;Daniel&nbsp;Treiber<br>
#&nbsp;-------------------------------</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="main.html#InputReader">InputReader</a>
</font></dt><dt><font face="helvetica, arial"><a href="main.html#OutputWriter">OutputWriter</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="InputReader">class <strong>InputReader</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="InputReader-read"><strong>read</strong></a>(self)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="OutputWriter">class <strong>OutputWriter</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="OutputWriter-write"><strong>write</strong></a>(self, *a)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-is_prime"><strong>is_prime</strong></a>(n)</dt><dd><tt>Checks&nbsp;if&nbsp;the&nbsp;passed&nbsp;in&nbsp;number&nbsp;is&nbsp;prime.&nbsp;If&nbsp;so&nbsp;return&nbsp;true,&nbsp;else&nbsp;false.&nbsp;<br>
N&nbsp;must&nbsp;be&nbsp;&lt;=&nbsp;10000000</tt></dd></dl>
 <dl><dt><a name="-main"><strong>main</strong></a>()</dt><dd><tt>Reads&nbsp;from&nbsp;stdin&nbsp;and&nbsp;calls&nbsp;my_eval&nbsp;on&nbsp;input.<br>
Outputs&nbsp;to&nbsp;stdout</tt></dd></dl>
 <dl><dt><a name="-my_eval"><strong>my_eval</strong></a>()</dt><dd><tt>Computes&nbsp;the&nbsp;sum&nbsp;of&nbsp;four&nbsp;primes&nbsp;that&nbsp;equal&nbsp;p.<br>
Requires&nbsp;p&nbsp;&lt;=&nbsp;10000000.<br>
Returns&nbsp;with&nbsp;primes[0...3]&nbsp;filled&nbsp;with&nbsp;four&nbsp;primes&nbsp;that&nbsp;sum&nbsp;to&nbsp;p&nbsp;if&nbsp;possible.<br>
If&nbsp;not&nbsp;possible,&nbsp;fills&nbsp;primes[3]&nbsp;with&nbsp;-1</tt></dd></dl>
 <dl><dt><a name="-my_print"><strong>my_print</strong></a>(w)</dt><dd><tt>writes&nbsp;the&nbsp;values&nbsp;of&nbsp;the&nbsp;four&nbsp;primes&nbsp;that&nbsp;make&nbsp;up&nbsp;the&nbsp;given&nbsp;input<br>
writes&nbsp;"Impossible."&nbsp;if&nbsp;the&nbsp;input&nbsp;cannot&nbsp;be&nbsp;expressed&nbsp;as&nbsp;the&nbsp;sum&nbsp;of&nbsp;four&nbsp;primes</tt></dd></dl>
 <dl><dt><a name="-my_read"><strong>my_read</strong></a>(r)</dt><dd><tt>reads&nbsp;an&nbsp;int&nbsp;into&nbsp;p<br>
return&nbsp;true&nbsp;if&nbsp;that&nbsp;succeeds,&nbsp;false&nbsp;otherwise</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>checkPrimes</strong> = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ...]<br>
<strong>p</strong> = 0<br>
<strong>primeDif</strong> = [[], [], [], [], [], [], [2, 2, 2], [2, 2, 3], [2, 3, 3], [3, 3, 3], [3, 2, 5], [5, 3, 3], [5, 5, 2], [5, 5, 3], [7, 5, 2], [11, 2, 2], [11, 3, 2], [13, 2, 2], [13, 3, 2], [13, 3, 3], ...]<br>
<strong>primes</strong> = [0, 0, 0, 0]</td></tr></table>
</body></html>